IF feelinbase := OpenLibrary('feelin.library',FV_VERSION)
WriteF('This test creates a memory pool with a thresh size of \d.\nThen it allocates \d items from the pool (\d in each puddle).\nExec pools and Feelin pools are tested.\n\nKeep in mind that F_Dispose() requires only the memory pointer as argument.\nF_Dispose() & F_DisposeP() will NEVER dispose a block that does not exists.\nMore over, memory freed is filled with $ABADF00D.\n\n',SIZE,NUM,ITEM)
Delay(50)
IF pool := CreatePool(MEMF_CLEAR,SIZE * ITEM,SIZE)
WriteF('AllocsPooled() ')
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1 DO array[i] := AllocPooled(pool,SIZE)
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
WriteF('FreePooled() ')
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1 DO array[i] := FreePooled(pool,array[i],SIZE) BUT NIL
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
DeletePool(pool)
ENDIF
IF pool := F_CreatePool(MEMF_CLEAR,SIZE,ITEM)
WriteF('F_NewP() ')
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1 DO array[i] := F_NewP(pool,SIZE)
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
WriteF('F_Dispose() ')
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1 DO array[i] := F_Dispose(array[i])
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
F_DeletePool(pool)
ENDIF
IF pool := F_CreatePool(MEMF_CLEAR,SIZE,ITEM)
WriteF('F_NewP() ')
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1 DO array[i] := F_NewP(pool,SIZE)
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
WriteF('F_DisposeP() ')
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1 DO array[i] := F_DisposeP(pool,array[i])
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
F_DeletePool(pool)
ENDIF
/*************/
/*** TEST2 ***/
/*************/
WriteF('\nThis test creates a memory pool with a thresh size of \d.\nThen it allocates and dispose one item %ld times.\nExec pools and Feelin pools are tested.\n\n',SIZE,NUM)
Delay(50)
IF pool := CreatePool(MEMF_CLEAR,SIZE * ITEM,SIZE)
WriteF('AllocsPooled() & FreePooled()')
AllocPooled(pool,SIZE)
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1
mem := AllocPooled(pool,SIZE)
FreePooled(pool,mem,SIZE)
ENDFOR
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
DeletePool(pool)
ENDIF
IF pool := F_CreatePool(MEMF_CLEAR,SIZE,ITEM)
WriteF('F_NewP() & F_Dispose() ')
F_NewP(pool,SIZE)
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1
mem := F_NewP(pool,SIZE)
F_Dispose(mem)
ENDFOR
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
F_DeletePool(pool)
ENDIF
IF pool := F_CreatePool(MEMF_CLEAR,SIZE,ITEM)
WriteF('F_NewP() & F_DisposeP() ')
F_NewP(pool,SIZE)
Forbid() ; DateStamp(ds1)
FOR i := 0 TO NUM - 1
mem := F_NewP(pool,SIZE)
F_DisposeP(pool,mem)
ENDFOR
DateStamp(ds2) ; Permit() ; saytime(ds1,ds2)
F_DeletePool(pool)
ENDIF
CloseLibrary(feelinbase)
ENDIF
ENDPROC
PROC saytime(ds1:PTR TO datestamp,ds2:PTR TO datestamp)